package com.example.client_anna.util.tool;

import android.util.Log;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author cy
 * @email 272884043@qq.com
 * @date 2021/10/19
 */
public class LocalThreadPools {

    private static ExecutorService executorService;

    public static synchronized ExecutorService getExecutorService(){

        if(executorService==null){
            executorService = Executors.newCachedThreadPool();
        }
        return  executorService;

    }

    public static void ShutdownLocalThreadPools(){

        if(!executorService.isShutdown()){
            executorService.isShutdown();
            Log.i("ThreadPool","Thread Shut Down!");
        }

    }

}
